<template>
	<view>
		<view class="modle_border" v-if="carslist.length>0">
			<view v-for="(item, index) in carslist" :key="index"
				@tap="item.status<3?'':item.delete_time>0?'':'retocards'" class="modle" :data-id="item.id">
				<image class="modle_img" :src="item.img_patch"></image>
				<view :class="item.status<3?'mengceng1':item.delete_time>0?'mengceng1':'nones'">
					{{item.status<3?'已下架':item.delete_time>0?'已删除':''}}</text></view>
				<view class="modle_name">{{item.name}} {{item.km}}万公里 {{item.agelimit<1?'准新车':item.agelimit+'年车'}}
					<>
						</text>undefined</tag>
						</text>undefined</tag>
						</text>
				</view>
			</view>
		</view>
		<block v-else>
			<!--<import src="/pages/data_null/index.wxml"></import>-->
			<view>
				<block data-type="template" data-is="title" data-attr="title:'暂无收藏数据'">
					<view class="zanwushuju_border">
						<image class="zanwushuju_border_img" src="/static/pages/image/none_message.png"></image>
						<view class="zanwushuju_border_title">{{'暂无收藏数据'}}</view>
					</view>
				</block>
			</view>
		</block>
	</view>
</template>

<script>
	var app = getApp(),
		leftid = 2;

	export default {
		data() {
			return {
				carslist: [],
				isShow: ""
			};
		},

		components: {},
		props: {},
		onLoad: function(t) {
			var a = this;
			app.globalData.util.request({
				url: "entry/wxapp/Api",
				data: {
					m: "monai_market",
					uid: app.globalData.getuid(),
					leftid: "",
					r: "sale.salelist.getcollection"
				},
				success: function(t) {
					a.setData({
						carslist: t.data.data
					});
				}
			});
		},
		onReachBottom: function() {
			var i = this,
				s = i.carslist;
			app.globalData.util.request({
				url: "entry/wxapp/Api",
				data: {
					m: "monai_market",
					uid: app.globalData.getuid(),
					leftid: leftid,
					r: "sale.salelist.getcollection"
				},
				success: function(t) {
					var a = t.data.data.length;
					if (leftid++, 0 < a)
						for (var e = 0; e < a; e++) s.push(t.data.data[e]);
					i.setData({
						carslist: s
					});
				}
			});
		},
		methods: {
			delcollection: function(e) {
				var i = this;
				console.log(e.currentTarget.dataset.id), app.globalData.util.getUserInfo(function(t) {
					t.memberInfo || that.setData({
						isShow: !0
					});
				}), app.globalData.util.request({
					url: "entry/wxapp/Api",
					data: {
						m: "monai_market",
						r: "me.follow",
						uid: app.globalData.getuid(),
						type: 2,
						ucar_id: e.currentTarget.dataset.id
					},
					cachetime: "0",
					success: function(t) {
						var a = i.carslist;
						a.splice(e.currentTarget.dataset.index, 1), i.setData({
							carslist: a
						});
					}
				});
			},
			retocards: function(t) {
				console.log(t.currentTarget.dataset.id), wx.navigateTo({
					url: "/pagesA/home/carMessage/carMessage?id=" + t.currentTarget.dataset.id
				});
			}
		}
	};
</script>
<style>
	@import "./index.css";
</style>
